package com.mnt.washio.utils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

import com.mnt.washio.objects.Address;
import com.mnt.washio.objects.Card;
import com.mnt.washio.objects.Coupon;
import com.mnt.washio.objects.DateExtraObject;

public class SessionManager {
	private static SessionManager mSessionManager;
	private static final String PREFS_FILE = "com.mnt.washio.session";
	private Coupon mCoupon;
	private List<Card> mCards = new ArrayList<Card>();
	private ArrayList<Address> ourArrayAddress = new ArrayList<Address>();
	private HashMap<String, ArrayList<DateExtraObject>> zipCodes = new HashMap<String, ArrayList<DateExtraObject>>();

	private SessionManager(Context context) {
		mCoupon = null;
	}

	public static SessionManager getSessionManager(Context context) {
		if (mSessionManager == null) {
			mSessionManager = new SessionManager(context);
		}
		return mSessionManager;
	}

	public static void destroySession() {
		mSessionManager = null;
	}

	public static void clear(Context context) {
		SharedPreferences pref = context.getSharedPreferences(PREFS_FILE,
				Context.MODE_PRIVATE);
		Editor editor = pref.edit();
		editor.clear();
		editor.commit();
	}

	public Coupon getCoupon() {
		return mCoupon;
	}

	public void setCoupon(Coupon coupon) {
		this.mCoupon = coupon;
	}

	public List<Card> getCardList() {
		return mCards;
	}

	public void setCardList(List<Card> cardList) {
		this.mCards = cardList;
	}

	/**
	 * @return the zipCodes
	 */
	public HashMap<String, ArrayList<DateExtraObject>> getZipCodes() {
		return zipCodes;
	}

	/**
	 * @param zipCodes the zipCodes to set
	 */
	public void setZipCodes(HashMap<String, ArrayList<DateExtraObject>> zipCodes) {
		this.zipCodes = zipCodes;
	}

	/**
	 * @return the ourArrayAddress
	 */
	public ArrayList<Address> getOurArrayAddress() {
		return ourArrayAddress;
	}

	/**
	 * @param ourArrayAddress the ourArrayAddress to set
	 */
	public void setOurArrayAddress(ArrayList<Address> ourArrayAddress) {
		this.ourArrayAddress = ourArrayAddress;
	}
	
	
	
}
